//
//  UIViewController+Ext.swift
//  SwiftApp
//
//  Created by ak on 2019/3/8.
//  Copyright © 2019 ak. All rights reserved.
//

import UIKit

fileprivate var RouteParamsKey = "RouteParamsKey"
public extension UIViewController {
  
  func getParams(key: String) -> String? {
    if let dic = objc_getAssociatedObject(self, &RouteParamsKey) as? [String: String?] {
      let value = dic[key]
      return value ?? nil
    }
    return nil
  }
  
  func setParams(params: [String: String?]) {
    objc_setAssociatedObject(self, &RouteParamsKey, params, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
  }
}
